package com.waar.kickball.model;

import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;

/**
 * @author Craig McIlwee
 * Copyright Lance + Craig 2013
 */
@Entity
@Table(name = "inning")
public class Inning extends KickballEntity {

	private int number;
	@OneToOne
	@JoinColumn(name = "top_frame_id", nullable = false)
	private Frame top;
	@OneToOne
	@JoinColumn(name = "bottom_frame_id")
	private Frame bottom;
	
	Inning() { }
	
	/**
	 * @param number of the inning
	 * @param top of the inning
	 * @param bottom of the inning
	 */
	public Inning(int number, Frame top, Frame bottom) {
		this.number = number;
		this.top = top;
		this.bottom = bottom;
	}
	
	/**
	 * @return the inning number
	 */
	public int getNumber() {
		return number;
	}
	
	/**
	 * @return the top of the inning
	 */
	public Frame getTop() {
		return top;
	}
	
	/**
	 * @return the bottom of the inning, may be null if not played
	 */
	public Frame getBottom() {
		return bottom;
	}
	
}
